<template>
	<view style="padding-top: 10px;">
		<view style="padding:10px 20px;background: rgb(255, 255, 255);color: rgb(102, 102, 102);">我的可提现{{res.coinname}}</view>
		<view style="padding:0 20px 10px;font-size:20px;line-height:20px;color:#ff8000;background:#fff;">{{res.ktx}}</view>
		<view style="padding: 10px 5px;">
			<button type="warn" style="font-size: 16px;background: #ff8000;" @click="next">下一步</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				res:[],
				openid:"",
				id:""
			};
		},
		onLoad:function(e){
			this.id = e.id
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.setAjax()
				},
				fail: () => {
					uni.navigateTo({
						url: '../login/login'
					});
				}
			});
		},
		methods:{
			setAjax(){
				uni.request({
					url: 'http://mall.zhongzhengyicai.com/app/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=commission.txsq&id='+this.id+'&app=1&openid='+this.openid,
					success: res => {
						console.log(res)
						uni.hideLoading()
						this.res = res.data
					},
					fail: () => {},
					complete: () => {}
				});
			},
			next(){
				uni.request({
					url: 'http://mall.zhongzhengyicai.com/app/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=commission.txsq&app=1',
					method: 'POST',
					data: {
						'openid':this.openid,
						'id':this.id
					},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res)
						uni.showToast({
							title: res.data.result.message,
							icon:"none"
						});
						setTimeout(()=>{
							uni.navigateBack();
						},1500)
						
					},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>

</style>
